package string;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class ArrayTest {

	public static void main(String[] args) {
		int[] arr = new int[] {12,3,4,5,6,7};
		int[][] arr2 = new int[][] {
				{2,3,4},
				{4,5,6}
		}; 
		System.out.println(Arrays.toString(arr));//打印数组
		System.out.println(Arrays.deepToString(arr2));
		
		
		List<String> list = new ArrayList<>();
		list.add("love");
		list.add("you");
		list.add("every");
		list.add("day");
		list.add("you");
		//这么删除一个Array里的元素是错误的
		/*for(String s : list) {
			if(s.equals("you"))
				list.remove(s);
		}*/
		
		//正确做法
		Iterator<String> iterator = list.iterator();
		while(iterator.hasNext()) {
			if(iterator.next().equals("you"))
				iterator.remove();
		}
		iterator = list.iterator();
		while(iterator.hasNext()) {
			System.out.println(iterator.next());
		}
		//System.out.println(list.size());
	}
}
